package com.spring.component.web;

import com.spring.component.auth.utils.RequestIgnoreList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @author liushihua
 * @since 2018年04月04日
 */
@Controller
@RequestMapping("/user")
public class UserController {

  @Autowired
  private RequestIgnoreList requestIgnoreList;

  @RequestMapping(value = "/test/*", method = RequestMethod.GET,
      produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  @ResponseBody
  public boolean test(HttpServletRequest request) {
    return requestIgnoreList.match(request);
  }

  @RequestMapping(value = "/**", method = RequestMethod.GET,
      produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  @ResponseBody
  public boolean test1(HttpServletRequest request) {
    return requestIgnoreList.match(request);
  }
}
